// 学校app端相关接口
// ！！app字段一定要为true！！

import request from "../utils/request";

/**
 * 创建计划
 * @param { * } id (不传默认获取最近一次)
 */
 export function creactPlanApi(data) {
  return request({
    url: `/api/plan/planCreate`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 查看个人所有事项
 * @param { * } bookId 书籍id(不传默认获取最近一次)
 */
export function getPlanListApi(data) {
  return request({
    url: `/api/plan/queryPlanByUidAndType`,
    method: "POST",
    loading: true,
    needLogin: false,
    data,
    body: true,
  });
}

/**
 * 查看当天所以事项
 * @param { * } bookId 书籍id(不传默认获取最近一次)
 */
 export function getTodoPlanListApi(data) {
  return request({
    url: `/plan/queryPlanByCondition`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}


/**
 * 查看协助详情
 * @param { * } openid 
 */
 export function getPlanInfoApi(data) {
  return request({
    url: `/api/team/selectDetails`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 加入团队
 * @param { * } code 
 * @param { * } uid 
 */
 export function joinTeamApi(data) {
  return request({
    url: `/api/team/joinTeam`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}


/**
 * 创建团队
 * @param { * } name 名称
 * @param { * } memo 备注
 * @param { * } uid 用户id
 * @param { * } planDOS 计划列表
 */
 export function createTeamApi(data) {
  return request({
    url: `/api/team/add`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 根据id来修改个人事项内容
 * @param { * } id id
 * @param { * } planPerPlan 内容
 */
 export function editPlanApi(data) {
  return request({
    url: `/api/team/update_team_plan_by_person`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}


/**
 * 解散团队
 * @param { * } openID 
 */
 export function deleteTeamApi(data) {
  return request({
    url: `/api/team/deleteTeam`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 退出团队
 * @param { * } openID 
 */
 export function returnTeamApi(data) {
  return request({
    url: `/api/team/returnTeam`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}



/**
 * 放弃计划
 * @param { * } id 
 */
 export function abandonPlanApi(data) {
  return request({
    url: `/api/plan/deletePlanById`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 获取打卡日历数据
 * @param { * } uid 
 */
 export function queryAllPlanDateApi(data) {
  return request({
    url: `/api/plan/queryAllPlanDate`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 获取打卡日历数据-按日期
 * @param { * } uid
 * @param { * } date
 */
 export function queryPlanByConditionApi(data) {
  return request({
    url: `/api/plan/queryPlanByCondition`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 获取打卡日历数据-按日期
 * @param { * } openid
 * @param { * } tiem
 */
 export function queryPlanGroupByYearApi(data) {
  return request({
    url: `/api/plan/queryPlanGroupByYear`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}




/**
 * 编辑
 * @param { * } id 
 */
 export function finishPlanApi(data) {
  return request({
    url: `/api/plan/editPlan`,
    method: "POST",
    loading: true,
    needLogin: false,
    data,
    body: true,
  });
}


/**
 * 获取协助列表
 * @param { * } openid
 * @param { * } tiem
 */
 export function selectByOneJoinTeamApi(data) {
  return request({
    url: `/api/team/selectByOneJoinTeam`,
    method: "GET",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}

/**
 * 编辑事项
 */
 export function editAgrencyApi(data) {
  return request({
    url: `/api/team/updateTeam`,
    method: "POST",
    loading: true,
    needLogin: true,
    data,
    body: true,
  });
}
